Skip to content

Webexception handling, possible fix for #132#159

Closed
Thorium wants to merge 4 commits intofsprojects:masterfrom
Thorium:webexception-handling
Closed

Webexception handling, possible fix for #132#159
Thorium wants to merge 4 commits intofsprojects:masterfrom
Thorium:webexception-handling

Conversation

@Thorium
Copy link
Copy Markdown
Member

@Thorium Thorium commented Jun 7, 2020

Reading the response body of non-ok web-request.
This could help for #132
My request didn't actually fail, so needs testing.

SwaggerProvider.Internal.SchemaReader.readSchemaPath "" filePath
|> Async.RunSynchronously

failwith "External definition of this path item is not supported yet"
Copy link
Copy Markdown
Member

@sergey-tihon sergey-tihon Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thorium few questions here

  1. Why to use basePath instead of schemaPathRaw? I would expect that $ref if relative to schema rather than API base path
  2. What is point to request schema before raising exception?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, with this commit was an earlier commit for the other PR #152
and with that I the failwith is still the old code, the Parsers.fs changes can be ignored.

else err.ToString()
| Choice2Of2 e -> return failwith(e.ToString())
| false ->
return schemaPathRaw |> IO.File.ReadAllText
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this line is inside async we can replace in by

use sr = new StreamReader(schemaPathRaw)
return! sr.ReadToEndAsync() |> Async.AwaitTask

@Thorium
Copy link
Copy Markdown
Member Author

Thorium commented Jun 7, 2020

I'll close this and redo the PR.

@Thorium Thorium closed this Jun 7, 2020
@Thorium Thorium deleted the webexception-handling branch June 8, 2020 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants